<!DOCTYPE html>
<html>
  <head>
    <title>
      <#if videoType=='1'||videoType=='2'>远程辅导<#else>视频点播</#if>
    </title>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
	  <link rel="stylesheet" href="${s.base}/mobile/css/base.css">
	  <link rel="stylesheet" href="${s.base}/mobile/css/component.css">
	  <link rel="stylesheet" href="${s.base}/mobile/css/weui.min.css">
	  <link rel="stylesheet" href="${s.base}/mobile/css/jquery-weui.css">
    <style type="text/css">
      .xyg-navigation{width:100%; height:auto;padding: 0.5rem; background: #fff;}
      .xyg-navigation .xyg-navigation-item{width:auto; padding: 0px 0.4rem; letter-spacing: 0.1rem; color: #000000; font-size: 14px; font-weight: bold;height:1rem; line-height: 1rem;float: left;}
      .xyg-navigation .xyg-navigation-line{width:0.1rem; margin:0.25rem 0.1rem; background:#0D0D0D;height:0.5rem;float: left;}
      </style>
  </head>
  <body>
  <div class="xyg-index">
    <div class="xyg-navigation" style="position: fixed; left: 0px; top: 0px;">
      <!--1、公益培训  2、非遗传习 ，3、品牌活动  4、非遗项目-->
      <#if videoType=='1'||videoType=='2'>
        <div class="xyg-navigation-item" onclick="initData('1')">公益培训</div>
        <div class="xyg-navigation-item" onclick="initData('2')">非遗传习</div>
        <#else>
          <div class="xyg-navigation-item" onclick="initData('3')">品牌活动</div>
          <div class="xyg-navigation-item" onclick="initData('4')">非遗项目</div>
      </#if>

      <div class="clearBoth"></div>
    </div>

    <div style="width: 100%; height: 2rem;"></div>
   <!--内容开始-->
  <div class="xyg-content">
  </div>
  <!--内容结束-->
  </div>
  
  
  </body>
  <script src="https://res.wx.qq.com/open/js/jweixin-1.3.2.js"></script>
  <script src="${s.base}/mobile/js/jquery-2.1.4.js"></script>
  <script src="${s.base}/mobile/js/jquery-weui.js"></script>
  <script src="${s.base}/mobile/js/dateUtil.js"></script>
  <script src="${s.base}/mobile/fonts/iconfont.js"></script>
  <script>
      var memberId='${memberId}';
      var videoType='${videoType}';
      var pageNum=0;
      var loading = false;  //状态标记
      var isDestroyInfinite = false;//是否销毁
      var pageSize=10;
      $(document).ready(function(e) {
          initData(videoType);
      });

      function initData(uType) {
          //设置type值
          videoType=uType;
          //清空内容
          $(".xyg-content").html("");
          //设置分页起始页数
          pageNum=0;
          //如果是销毁，初始化下拉刷新
          if(isDestroyInfinite){
              $(document.body).infinite();
              $(document.body).infinite().on("infinite", function() {
                  if(loading) return;
                  loading = true;
                  sendPost();
              });
          }
          //首次调用内容
          sendPost();
      }

      function sendPost() {
          pageNum++;
          $.post("/phone/videoPage",{
              pageNum : pageNum,
              pageSize : pageSize,
              videoType : videoType
          },function(resultInfo){
              if (resultInfo.code == 0){
                  if (resultInfo.data!=null && resultInfo.data.length > 0){
                      for(var i=0;i<resultInfo.data.length;i++){
                          var obj = resultInfo.data[i];
                          var content=
                              '<div class="xyg-content-item"><a href="'+obj.url+'">'+
                              '<div class="xyg-content-item-pic">'+
                              '<img src="'+ obj.picture+'"/>'+
                              '</div>'+
                              '<div class="xyg-content-item-content">'+
                              '<div class="xyg-content-item-content-tip font1 padding-t1" style="line-height: 2rem;">'+ obj.title+
                              ' </div>'+
                              '</div>'+
                              '</a></div>';
                          $(".xyg-content").append(content);
                          loading = false;
                          if(!resultInfo.hasNextPage){
                              $(document.body).destroyInfinite();
                          }
                      }
                  }
              }
          },"json");
      }


  </script>
</html>

